home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
476-500
/
disk_488
/
lordofhosts
/
lohsrc.lzh
/
Lord.h
< prev
next >
Wrap
C/C++ Source or Header
|
1991-05-10
|
4KB
|
156 lines
/* LORD OF HOSTS - Lord.h --- Headerdatei */
#include <functions.h>
#include <exec/types.h>
#include <exec/interrupts.h>
#include <devices/input.h>
#include <devices/inputevent.h>
#include <devices/gameport.h>
#include <intuition/intuition.h>
#include <graphics/gfxbase.h>
#include <stdlib.h>
#include "req.h"
#include "reqbase.h"
#include <libraries/dosextens.h>
#include <stdio.h>
#include <stddef.h>
#include <errno.h>
#include <string.h>
struct Piece
{
int Number;
int ID; /* R/WKING || R/WKNIGHT */
int Value;
UBYTE x,y;
BOOL StillAlive;
};
struct Move
{
UBYTE fromx,fromy;
UBYTE tox,toy;
int Beaten;
BOOL x_first;
BOOL GameOver;
int status;
};
#define VERSION "1.0"
/* für Zugriff auf das Feld Pieces[4] */
#define RKING 0
#define WKING 1
#define RKNIGHT 2
#define WKNIGHT 3
/* JoyMouse */
#define SPEED 5
/* für Feld-Matrix */
#define NOT_OCCUPIED 20
/* Werte für check_move(): Gründe, warum gewünschter Zug ungültig */
#define DIST_EXCEEDED 1
#define MUST_MOVE_FARTHER 2
#define WAY_BLOCKED 4
#define CANT_BEAT_BUDDY 8
#define KING_IN_DANGER 16
/* Bei gültigem Zug gibt check_move() zurück, in welche Richtung erst gezogen
werden sollte (muß) */
#define MOVE_X_FIRST 128
#define MOVE_Y_FIRST 256
/* Werte für do_move(): Spezialsituation nach einem Zug (Check, Matt) */
#define ENEMY_KING_BEATABLE 1
#define ENEMY_MATED 2
#define ENEMY_OUT_OF_KNIGHTS 4
#define ENEMY_KNIGHT_BEATEN 8
/* für Undo/Redo */
#define MAXUNDO 500
#define NOBODY 20
#define ABS(x) ((x)<0 ? -(x) : (x))
/* board */
#define STD_NORM 0
#define STD_ROTD 1
#define RND_BAL 2
#define RND_UNB 3
/* status */
#define IDLE 0 /* kein Spiel im Gange */
#define IN_GAME 1 /* Spiel läuft */
#define PLAYER1_TO_MOVE 2 /* wenn dieses Bit gesetzt ist, ist Spieler 1 dran */
#define WAITING_FOR_PICK 4 /* Der Computer erwartet, daß der Stein gewählt wird,
der ziehen soll */
#define WAITING_FOR_DEST 8 /* Nun soll das Zugziel gewählt werden */
#define WAITING_FOR_CONF 16 /* Im Show...Values-Modus ist der Probezug
gemacht und muß nun bestätigt werden */
#define BOARD_UNTOUCHED 32 /* Brett ist noch nicht benutzt worden */
/* help */
#define NOHELP 0
#define SHOWKNOWN 1
#define SHOWALL 2
/* misc */
#define RED FALSE
#define WHITE TRUE
#define SWITCHSIDENR (SHIFTMENU(2)+SHIFTITEM(6)+SHIFTSUB(NOSUB))
/* Prototypes
* joymouse.c */
void swapjoymouse(BOOL what);
struct InputEvent *JoyMouseHandler(struct InputEvent *Event, ULONG *Data);
/* openclose.c */
void errorstop(char *message);
void open_all(void);
void close_all(void);
/* display.c */
void DrawRect(ULONG Color, ULONG DrMd, ULONG fromx, ULONG fromy, ULONG tox,
ULONG toy);
void DrawLine(ULONG Color, ULONG DrMd, ULONG fromx, ULONG fromy, ULONG tox,
ULONG toy);
void FillRect(ULONG Color, ULONG fromx, ULONG fromy, ULONG tox, ULONG toy);
void DrawText(ULONG Color, ULONG DrMd, ULONG x, ULONG y, char *string);
void drawboard(void);
void drawplayers(char *Name1, char *Name2);
void SetPiece(struct Piece Which, BOOL FadeIn, BOOL StayBlend);
void MovePiece(UBYTE x, UBYTE y, int xdist, int ydist, BOOL FadeOut);
void Highlight(UBYTE x, UBYTE y);
/* board.c */
void setup_stdboard(BOOL Rotated);
void setup_rndboard(BOOL Balanced);
UBYTE GetValue(int Num, UBYTE x, UBYTE y);
UBYTE IsOccupied(UBYTE x, UBYTE y);
void InitPiece(int Num, int ID, int Val, UBYTE x, UBYTE y);
void clear_board(void);
/* moves.c */
int check_move(UBYTE board[][8], struct Piece *Pieces, int Num,
UBYTE tox, UBYTE toy);
int how_to_move(UBYTE board[][8],
UBYTE fromx, UBYTE fromy, UBYTE tox, UBYTE toy);
int check_check(UBYTE board[][8], struct Piece *Pieces, int Num,
UBYTE tox, UBYTE toy);
int do_move(UBYTE board[][8], struct Piece *Pieces, int Num,
UBYTE tox, UBYTE toy, BOOL x_first);
BOOL undo(void);
BOOL redo(void);
/* disk.c */
void FileError(int Error);
BOOL checkrange(int Var, int lo, int hi);
void SaveGame(void);
void LoadGame(void);
/* misc.c */
void Rules(void);
void ExplainError(int Error);
void About(void);
void SetJMSpeed(void);
void EnterNames(void);
BOOL Coords(SHORT MouseX, SHORT MouseY, UBYTE *x, UBYTE *y);
void Exchange(UBYTE *a, UBYTE *b);
void Notify(int Nr, int occurrence);
void NextPlayer(BOOL who);
/* main.c */
void main(void);
void wait_events(void);
void handle_menuevents(void);
void handle_mouseevents(void);